package com.hugboy.string;

import java.util.Scanner;

public class Demo6charCount {
    /*
    统计 大写、小写、数字
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("input a str:");
        String scStr = sc.nextLine();
        int lowerCount = 0;
        int upperCount = 0;
        int numberCount = 0;
        for(int i=0; i<scStr.length();i++){
            char c = scStr.charAt(i);
            if(c >= 'A' && c<='Z'){
                upperCount++;
            }
            else if(c>='a' && c<='z'){
                lowerCount++;
            }
            else if(c>='0' && c<='9'){
                numberCount++;
            }
        }
        System.out.println("upperCount: "+upperCount);
        System.out.println("lowerCount: "+lowerCount);
        System.out.println("numberCount: "+numberCount);

    }
}
